import request from '../utils/request'

/**
 * 登录
 */
export const userLogin = (data) => {
  return request.post('/user/login', data)
}

/**
 * 用户是否收藏
 * @param {*} id
 * @returns
 */
export const isFavorites = (id) => {
  return request.get('/user/favorites/' + id)
}

/**
 * 添加收藏房源
 */
export const addFavorites = (id) => {
  return request.post('/user/favorites/' + id)
}

/**
 * 删除收藏房源
 */
export const removeFavorites = (id) => {
  return request.delete('/user/favorites/' + id)
}

/**
 * 获取用户信息
 */
export const getUserInfo = () => {
  return request.get('/user')
}

/**
 * 用户退出
 */
export const logout = () => {
  return request.post('/user/logout')
}

/**
 * 获取收藏列表
 * @returns
 */
export const getFavorate = () => {
  return request.get('/user/favorites')
}

/**
 * 获取已发布房源
 * @returns
 */
export const getMyRent = () => {
  return request.get('/user/houses')
}

/**
 * 发布房源
 * @param {*} data
 * @returns
 */
export const postHouse = (data) => {
  return request.post('/user/houses', data)
}
